<?php
/**
 * Created by PhpStorm.
 * User: denh
 * Date: 16/12/20
 * Time: 上午10:00
 */
namespace bs\wxNews;

require_once _LHDir. 'bs/wxNews/Base.php';

class Task extends Base {

    function sendNews($userArray) {
        $this->addPictureTextNews($userArray);
        $this->addTemplateNews($userArray);

        $this->sendPicTextTemplateNews($userArray);
    }

    function addPictureTextNews($userArray = null) {
        $this->pictureTextNews = new \Cbo图文消息列表();
        $url = sprintf($this->doTemplate->get_url(), $userArray['userCenterID']);
        $this->pictureTextNews->ft添加图文消息($this->doTemplate->get_pt_title(), $this->doTemplate->get_pt_desc(),
            $url, $this->doTemplate->get_pt_pic());
    }

    function addTemplateNews($userArray = null) {
        global $G_CONFIG;
        $this->templateNews->templateId = $G_CONFIG['模板消息ID']['咨询模板'];
        $this->templateNews->url = sprintf($this->doTemplate->get_url(), $userArray['userCenterID']);
        $this->templateNews->data = array(
            'first' => array('value' => $this->doTemplate->get_template_first() . "\n", 'color' => '#5C94C6'),
            'keyword1' => array('value' => $this->doTemplate->get_template_keyword1(), 'color' => '#CCCCCC'), //消息类别
            'keyword2' => array('value' => $this->doTemplate->get_template_keyword2(), 'color' => '#CCCCCC'), //发布人
            'keyword3' => array('value' => $this->doTemplate->get_template_keyword3(), 'color' => '#CCCCCC'), //发布时间
            'remark' => array('value' => "\n" . $this->doTemplate->get_template_remark(), 'color' => '#A6A6A6')
        );
    }
}